<?php
require_once("../include/simplepie/simplepie.inc");
?>
<html>
<head>
	   <title></title>
</head>
<body>

<?php 

#$feed = new SimplePie("http://twitter.com/statuses/user_timeline/23965293.rss");
$feed = new SimplePie();
$feed->set_feed_url("http://www.oracle.com/us/corporate/press/rss/rss-pr.xml");
$feed->set_cache_location('/mnt/developer/rss/cache');
$feed->enable_cache();
$feed->init();


#print_r($feed);

?>

	<table border="1" data-bitzer-data="TRUE"
	       data-bitzer-title="Oracle"
	       data-bitzer-desc="Oracle Feed"
	       data-bitzer-component="oracle"
	       data-bitzer-start-index="1" 
	       data-bitzer-number-of-rows="10" 
	       data-bitzer-record-count="10" >
		      <tr>
			      <th data-bitzer-field="image" >image</th>
			      <th data-bitzer-field="title" >title</th>
			      <th data-bitzer-field="content">content</th>
			      <th data-bitzer-field="link">link</th>
			      <th data-bitzer-field="author">Creator</th>
			      <th data-bitzer-field="publish_date">publish date</th>
			      <th data-bitzer-field="last_modified_on">last_modified_on</th>
		      </tr>
<?php


foreach ($feed->get_items(0, 10) as $item) {

$string =  preg_replace('#<!\[CDATA\[.*?\]\]>#s', '', $item->get_content());

$doc = new DOMDocument();
$doc->loadHTML($item->get_description());

$image = $doc->getElementsByTagName('img')->item(0);
$body = $doc->getElementsByTagName('body')->item(0);

$title = preg_replace('#<!\[CDATA\[.*?\]\]>#s', '', $item->get_title());
$content =  preg_replace('#<!\[CDATA\[.*?\]\]>#s', '', $body->textContent);


	echo "<tr>";
	echo "<td></td>";
	echo "<td>".$title."</td>";
	echo "<td>".$content."</td>";
	echo "<td>".$item->get_permalink()."</td>";
	echo "<td>".$item->get_contributor()."</td>";
	echo "<td>".$item->get_date()."</td>";
	echo "<td>".$item->get_date()."</td>";
	echo "</tr>";
	}
?>
		</table>
	</body>
</html>
